<template>
    <div class="warp">
        <van-nav-bar title="历史记录" :fixed="true" >
            <i class="iconfont ireturn" slot="left" @click="back"></i>
            <span slot="right" @click="cleanHis" >清空</span>
        </van-nav-bar>
        <div class="v-body">
            <p class="v-notice">{{msg}}</p>
              <van-row gutter="10"  v-for="item in hisData" class="v-item">
                  <van-col span="8" >
                    <a :href="'#/detail/'+item.vid">
                        <div class="v-item-imghd">
                          <img v-lazy="item.vpic" />
                          <span class="v-item-imghd-hot">{{item.vnote}}</span>
                        </div>
                    </a>
                  </van-col>
                  <van-col span="16">
                    <a :href="'#/detail/'+item.vid">
                        <h2>{{item.vname}}</h2>
                        <p>{{item.vpublishyear +'/'}}{{item.vpublisharea+'/'}}{{item.tnamel2}}</p>
                        <p>{{item.hdate}}</p>
                    </a>
                  </van-col>
              </van-row>
        </div>
        <BackTop />
    </div>
</template>
<script>
export default {
  name: "history",
  components: {
  },
  data() {
    return {
      tabActive: 0,
      testData: [],
      tdata: {
        pic: "../assets/img/350.jpg",
        name: "陈情令",
        status: "更新至50-已完结"
      },
      hisData:[],
      msg:'',
    };
  },
  methods: {
    back() {
      this.$back();
    },
    cleanHis(){
        vshow.his.cleanHis();
        this.hisData = [];
        this.msg = '无历史记录';
    },
    loadHisData(){
      this.hisData =  vshow.his.getDataHis();
      if(this.hisData.length > 0){
          this.msg = '历史记录只保存近'+vshow.his.hisCount+'次访问记录';
      }else{
          this.msg = '无历史记录';
      }
    }
  },
  mounted() {
    this.loadHisData();
  }
};
</script>
<style lang="less" >
</style>
